$eval ( type in module ng )

Description

Executes the expression on the current scope returning the result. Any exceptions in the expression are propagated (uncaught). This is useful when evaluating Angular expressions.

Example

           var scope = ng.$rootScope.Scope();
           scope.a = 1;
           scope.b = 2;

           expect(scope.$eval('a+b')).toEqual(3);
           expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);

Usage

Scope#$eval([expression]);

Parameters

Returns

{*}

The result of evaluating the expression.